<!--
* 开源版本请务必保留此注释头信息，若删除捷码开源〔GEMOS〕官方保留所有法律责任追究！
* 本软件受国家版权局知识产权以及国家计算机软件著作权保护（登记号：2018SR503328）
* 不得恶意分享产品源代码、二次转售等，违者必究。
* Copyright (c) 2020 gemframework all rights reserved.
* http://www.gemframework.com
* 版权所有，侵权必究！
-->
<!DOCTYPE html>
<html lang="zh-cn" class="fullscreen-bg" xmlns:th="http://www.thymeleaf.org">
<head th:replace="common/links :: common_header(~{::title},~{::link},~{})">
    <script>if (window !== top) top.location.replace(location.href);</script>
    <title>请您登录 | GemFrame开源权限管理系统v1.0.10</title>
    <link th:href="@{/coral/css/oschina.css}" rel="stylesheet">
</head>
<body class="sc animated fadeInLeft" style="min-height: 660px;"> <!--[if lte IE 10]>
<script>window.location.href = '/fast/upbw/index';</script><![endif]--><!-- 如果客户浏览器版本过低，则显示浏览器升级提示-->
<header class="home-header">
    <a href="http://www.gemframework.com" target="_blank">
        <span class="logo">捷码开源</span>
    </a>
</header>
<section class="box vertical home-wrapper">
    <div id="app" class=" login-body">
        <nav class="login-tabs"><span class="tab-bg"></span></nav>
        <div class="text-center login-title"> 欢迎登录</div>
        <div class="box">
            <div class="box-aw login-box">
                <article>
                    <div id="account_login" class="account-login tab-box">
                        <form class="layui-form">
                            <div class="login-form form-wrapper">
                                <div class="form-item">
                                    <div class="form-ctrl">
                                        <input type="text" name="username" placeholder="请输入账号" lay-verify="required" required>
                                    </div>
                                </div>
                                <div class="form-item">
                                    <div class="form-ctrl">
                                        <input type="password" name="password" placeholder="密码" value="123456" lay-verify="required" required>
                                    </div>
                                </div>
                                <div class="form-item">
                                    <div class="form-ctrl">
                                    <input id="validCode" type="text" name="validCode" placeholder="请输入验证码" lay-verify="required" required></div>
                                    <img class="login-captcha" src="captcha/code" width="130px" height="48px" />
                                </div>
                                <div class="form-item form-button">
                                    <button type="button" class="btn btn-green block btn-login" lay-filter="loginSubmit" lay-submit>登录</button>
                                </div>
                                <div class="form-item">
                                    使用其他账号登录？开发中...
                                </div>
                            </div>
                        </form>
                    </div>
                </article>
            </div>
            <div class="box-fr other-login-wrapper"> Gem-Coral 是一个 Java 企业级快速开发平台，基于经典主流的技术框架组合
                <HR/>
                <B>【Spring Boot v2.2.x】</B>
                <HR/><B>【Apache Shiro v1.4.x】</B>
                <HR/><B>【MyBatis-Plus v3.3.x】</B>
                <HR/><B>【Layui v2.5.6】</B>
                <HR/>
                开箱即用，学习成本极低，提高团队开发效率。
            </div>
        </div>
    </div>
</section>
<footer class="home-footer">
    <div>
        <div>
            <span class="copy">Copyright © [[${#dates.format(new java.util.Date().getTime(), 'yyyy')}]] Powered By <a href="http://www.gemframework.com" target="_blank"> gemframework.com </a>
            | <a href="http://www.gemframework.com" target="_blank">项目官网</a>
            | <a href="http://www.gemframework.com/bbs" target="_blank">社区交流</a>
            | <a href="login.html">捷码登录</a>
            | <a href="login_gitee.html">仿码云</a>
            </span>
        </div>
        <div>

        </div>
    </div>
</footer>

<!-- js部分 -->
<div th:replace="common/scripts :: common"></div>
<div th:replace="common/scripts :: jquery"></div>
<script>
    layui.use(['admin', 'layer', 'form', 'notice'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var form = layui.form;
        var notice = layui.notice;
        var admin = layui.admin;

        //登录超时处理
        if (top.location.href != self.location.href) {
            layer.alert("登录超时，请重新登录！", {
                closeBtn: 0
                , icon: 5
                , anim: 4 //动画类型
            }, function () {
                top.location.href = self.location.href;
            });
        }

        // 表单提交
        form.on('submit(loginSubmit)', function (obj) {
            obj.field.password = window.btoa(obj.field.password);
            $.ajax({
                type: "post",
                url: "login",
                data: obj.field,
                async: true, // 异步请求
                cache: false, // 设置为 false 将不缓存此页面
                dataType: "json", // 返回对象
                success: function (res) {
                    if (res.code == "0") {
                        layer.msg('登录成功', {icon: 1, time: 1500}, function () {
                            location.replace('index')
                        });
                    } else {
                        $(".login-captcha").click();
                        notice.error({
                            title: '登录失败',
                            message: "错误码：[" + res.code + "]    错误消息：" + res.msg + "",
                            theme: "light",
                            displayMode: 2,
                            layout: 2
                        });
                    }
                },
                error: function (e) {
                    // 请求失败函数
                    console.log("error:" + JSON.stringify(e));
                    layer.msg("操作失败，请检查是否有相关操作权限！");
                }
            })
            return false;
        });

        // 图形验证码
        $('.login-captcha').click(function () {
            this.src = this.src + '?t=' + (new Date).getTime();
        });
        $("#validCode").click(function(){
            $(".login-captcha").click()
        })

        //主题随机
        var theme = ["colorful", "blue", "green", "purple", "pink", "cyan"];
        var i = Math.round(Math.random() * 5);
        // admin.changeTheme("theme-" + theme[i]);
        admin.changeTheme("theme-" + theme[1]);
        var img_url = [
            "coral/images/bg_login5.jpg"
            , "coral/images/bg_login.png"
            , "coral/images/bg_login1.png"
            , "coral/images/bg_login2.png"
            , "coral/images/bg_login3.png"
            , "coral/images/bg_login4.jpg"
        ];
        $("body").css("background-image", "url(" + img_url[1] + ")");
    });

</script>
</body>
</html>